{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "文件: 铁通2401\\240052_窦鸣宇\\240052 窦鸣宇.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\240179_陈金妙\\240179陈金妙.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\240430_党梦轩\\240430党梦轩.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\240432_王舒心\\240432王舒心.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\240433_徐博恩\\240433徐博恩.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\240778_寇云霄\\240778寇云霄.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\241021_张佳堙\\241021张佳堙.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\241041_肖百禾\\241041肖百禾.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\241060_王佳怡\\241060王佳怡.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\241181_孟敬媛\\241181孟敬媛.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\241341_杨憧憬\\新建文本文档.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\241385_张春浩\\241385张春浩.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\241563_张美辰\\241563张美辰.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\241632_王杨宇飞\\241632王杨宇飞.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\241730_何晨雨\\241730何晨雨.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\243902_郑昱栋\\243902郑昱栋.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\243905_赵玮伊\\赵玮伊.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\243906_沈冰悦\\243906沈冰悦.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\243907_高心阳\\243907高心阳.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\243909_唐岩\\243909唐岩.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\243911_张延兴\\243911张延兴.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\243912_葛李彤\\243912葛李彤.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\243913_付奕雅\\243913付奕雅.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\243914_许克\\243914许克.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\244501_贺立上\\244501贺立上.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\244503_宋瑞宇\\244503宋瑞宇.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\244695_陈乐轩\\244695陈乐轩.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\244696_陈淑婷\\244696陈淑婷.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\244835_杨晨\\244835 杨晨.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\245049_刘怡楠\\245049刘怡楠.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\245053_司竹颜\\245053司竹颜.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\245056_郑浩\\245056 郑浩.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\张聪_张聪\\240338张聪.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n",
      "文件: 铁通2401\\杨涵馥_杨涵馥\\241444杨涵馥.txt\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "\n",
    "def list_files_content(folder_path):\n",
    "    # 确保提供的路径是一个目录\n",
    "    if not os.path.isdir(folder_path):\n",
    "        print(f\"提供的路径不是一个目录：{folder_path}\")\n",
    "        return\n",
    "\n",
    "    # 列出文件夹下所有文件的内容\n",
    "    for root, dirs, files in os.walk(folder_path):\n",
    "        for file in files:\n",
    "            file_path = os.path.join(root, file)\n",
    "            try:\n",
    "                with open(file_path, 'r', encoding='utf-8') as f:\n",
    "                    content = f.read()\n",
    "                    print(f\"文件: {file_path}\")\n",
    "                    print(content)\n",
    "                    print(\"\\n\" + \"-\" * 80 + \"\\n\")\n",
    "            except UnicodeDecodeError:\n",
    "                print(f\"文件{file_path}编码错误，尝试使用其他编码方式读取。\")\n",
    "            except Exception as e:\n",
    "                print(f\"无法读取文件{file_path}: {e}\")\n",
    "\n",
    "# 文件夹路径\n",
    "folder_path = '铁通2401'  # 请确保这是正确的文件夹路径\n",
    "list_files_content(folder_path)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
